// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Decoration
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 28 : TYPE_DECORATION

private alias object.value1 : bar.xpos

public value barScore = 0;

event ObjectMain
	bar.xpos = 82	//starting position
	
	if inputpress[0].buttonX == 1
		barScore -= 10
	end if

	if barScore >= 84
		object[0].state = 1
	end if

	if barScore >= 84	//dont go over the limit
		barScore = 84
	end if

	if barScore <= -100
		barScore = -100
	end if

	bar.xpos += barScore
end event

event ObjectDraw
	object.drawOrder = 5

	//Yellow Outline
	temp3 = screen.xcenter
	temp3 -= 82
	DrawRect(temp3, 18, 170, 24, color7, color7, 0, 255)	

	//Green
	temp3 = screen.xcenter
	temp3 -= 80
	DrawRect(temp3, 20, 165, 20, 0, color7, 0, 255)	


	temp3 = screen.xcenter
	temp3 -= 80
	DrawRect(temp3, 20, bar.xpos, 20, color7, 0, 0, 255)	



	if bar.xpos >= 0
		DrawSpriteScreenXY(1, bar.xpos, 30)
		DrawSpriteScreenXY(0, bar.xpos, 30)	
	else
		DrawSpriteScreenXY(1, 0, 30)		
		DrawSpriteScreenXY(0, 0, 30)
	end if

	object.priority = PRIORITY_ACTIVE
end event


event ObjectStartup
	object.value0 = 0	
	LoadSpriteSheet("3D_Test/Funkin.gif")
	SpriteFrame(140, -10, 22, 20, 39, 45) //0  sonic
	SpriteFrame(95, -12, 34, 24, 62, 45) //1 slend
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
